package practice;

import java.util.Scanner;

public class _08Square {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] rectangle1 = new int[4];
        int[] rectangle2 = new int[4];
        for (int i = 0;i < 4;i++){
            rectangle1[i] = scanner.nextInt();
        }
        for (int i = 0;i < 4;i++){
            rectangle2[i] = scanner.nextInt();
        }
        scanner.close();
        int x1 = Math.min(rectangle1[0],rectangle2[0]);
        int y1 = Math.min(rectangle1[1],rectangle2[1]);

        int x2 = Math.max(rectangle1[2],rectangle2[2]);
        int y2 = Math.max(rectangle1[3],rectangle2[3]);

        int merge = Math.max(Math.abs(x1-x2),Math.abs(y1-y2));
        System.out.println(merge*merge);
    }
}
